part of _;

extension on ScanQRCodePage {
  Widget view_scan() {
    return ScanView(
      controller: scanController,
      scanAreaScale: .7,
      scanLineColor: YConfig.themeColor,
      onCapture: (data) {
        result = data;
        yFinish();
      },
    );
  }

  Widget view_top() {
    return Positioned(
      top: yStatubarHeight(),
      left: 10,
      child: YInkRoundButton(Icon(Icons.close, color: Colors.white), onTap: () => yFinish()),
    );
  }

  Widget view_bottom() {
    return Positioned(
      bottom: ySafeAreaBottomHeight() + 50,
      left: 50,
      right: 50,
      child: Row(
        children: [
          YInkRoundButton(
            Icon(flash_on ? Icons.flash_on : Icons.flash_off, color: Colors.white),
            onTap: () => controller_toggleFlash(),
          ),
          YExpanded(),
          YInkRoundButton(
            Icon(Icons.image_outlined, color: Colors.white),
            onTap: () => controller_selectAssets(),
          ),
        ],
      ),
    );
  }
}
